package com.hnas.eCard.dao.impl;

import java.util.List;

import javax.persistence.Query;

import org.springframework.stereotype.Component;

import com.hnas.core.dao.BaseDaoImpl;
import com.hnas.eCard.dao.MerchantDetailDao;
import com.hnas.eCard.orm.MerchantDetail;

@Component("merchantDetailDao")
public class MerchantDetailDaoImpl extends BaseDaoImpl<MerchantDetail> implements MerchantDetailDao{

	public MerchantDetailDaoImpl() {
		super(MerchantDetail.class);
	}

	@Override
	public List<MerchantDetail> listAllByMerchantId(String merchantId) {
		String sql = "select * from tbl_merchant_detail where is_deleted = 0 and merchant_id = ?1 order by sort asc";
		Query query = this.entityManager.createNativeQuery(sql,MerchantDetail.class);
		query.setParameter(1, merchantId);
		return query.getResultList();
	}

}
